/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bd_tenencias;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Earving
 */
@Entity
@Table(name = "generos")
@NamedQueries({
    @NamedQuery(name = "Generos.findAll", query = "SELECT g FROM Generos g"),
    @NamedQuery(name = "Generos.findByIdgeneros", query = "SELECT g FROM Generos g WHERE g.idgeneros = :idgeneros"),
    @NamedQuery(name = "Generos.findByDescripcion", query = "SELECT g FROM Generos g WHERE g.descripcion = :descripcion")})
public class Generos implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idgeneros")
    private Integer idgeneros;
    @Basic(optional = false)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(mappedBy = "generos")
    private List<Propietario> propietarioList;

    public Generos() {
    }

    public Generos(Integer idgeneros) {
        this.idgeneros = idgeneros;
    }

    public Generos(Integer idgeneros, String descripcion) {
        this.idgeneros = idgeneros;
        this.descripcion = descripcion;
    }

    public Integer getIdgeneros() {
        return idgeneros;
    }

    public void setIdgeneros(Integer idgeneros) {
        Integer oldIdgeneros = this.idgeneros;
        this.idgeneros = idgeneros;
        changeSupport.firePropertyChange("idgeneros", oldIdgeneros, idgeneros);
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        String oldDescripcion = this.descripcion;
        this.descripcion = descripcion;
        changeSupport.firePropertyChange("descripcion", oldDescripcion, descripcion);
    }

    public List<Propietario> getPropietarioList() {
        return propietarioList;
    }

    public void setPropietarioList(List<Propietario> propietarioList) {
        this.propietarioList = propietarioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idgeneros != null ? idgeneros.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Generos)) {
            return false;
        }
        Generos other = (Generos) object;
        if ((this.idgeneros == null && other.idgeneros != null) || (this.idgeneros != null && !this.idgeneros.equals(other.idgeneros))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bd_tenencias.Generos[idgeneros=" + idgeneros + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
